<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/easyui/1.4.1/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/datagrid-detailview.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="/easyui/1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/1.4.1/themes/icon.css">
</head>
<style>
    .contentDatagrid {
        height: 75vh;
        padding-bottom: 30px;
    }

    /*tr td{
        background-color: #666d70;
        color : white!important;
    }*/
</style>
<script>
    function format(value, row, index) {
        if (value == 1) {
            return "未回复";
        } else if (value == 2) {
            return "已回复";
        }
    }
</script>
<body data-type="index" >
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">文章列表</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">

                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span
                                            class="am-icon-archive" data-am-modal="{target: '#reply'}"></span> 回复
                                    </button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span
                                            class="am-icon-trash-o"></span> 删除
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-offset-3 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" class="am-form-field ">
                            <span class="am-input-group-btn">
            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"
                    type="button"></button>
          </span>
                        </div>
                    </div>

                    <div class="am-u-sm-12 contentDatagrid">
                        <table id="grids" toolbar="#toolbar"
                               noheader="true" border="false" striped="true"
                               fitColumns="true" singleSelect="true"
                               pagination="true" multiSort="true">
                            <thead>
                            <tr>
                                <th data-options="field:'ck',checkbox:true"></th>
                                <th field="id" width="150px">ID</th>
                                <th field="ip" width="100px">用户ip</th>
                                <th field="title" width="100px">文章标题</th>
                                <th field="author" width="150px">用户名称</th>
                                <th field="content" width="150px">留言内容</th>
                                <th field="agent" width="150px">留言设备</th>
                                <th field="created" width="150px">留言时间</th>
                                <th field="status" width="150px" formatter="format">是否回复</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="am-modal am-modal-no-btn" tabindex="-1" id="reply">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">Modal 标题
            <a href="javascript:void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
        </div>
        <div class="am-modal-bd">
            Modal 内容。
        </div>
    </div>
</div>


<script>
    var id;
    $(function () {
        load();
    })
    function load() {
        $('#grids').datagrid({
            idField: 'id',
            url: "/cms/commentList",
            fit: true,
            onSelect: function (rowIndex, rowData) {
                id = rowData.id;
            },
            onDblClickCell: function (rowIndex, rowData) {
                show();
            }
        })
    }
    function show() {
        $('#reply').modal('open');
    }
</script>

</body>
</html>